
from django.conf.urls import url

from users import views
from rest_framework_jwt.views import obtain_jwt_token

urlpatterns = [
    url(r"^usernames/(?P<username>\w{5,20})/count/$", views.UsernameExist.as_view()),
    url(r"^imagecodeid/(?P<image_code_id>[\w-]+)/$", views.ImageCodeView.as_view()),
    url(r"^register/$", views.UserRegisterView.as_view()),
    url(r"^login/$", obtain_jwt_token),
    url(r"^userlist/$", views.GetUserList.as_view()),
    url(r"^userinfo/$", views.UserInfoView.as_view()),
    url(r"^staffmanagestore/$", views.ReturnStaffAndStoreView.as_view()),
    url(r"^createregistercode/$", views.CreateRegisterCodeView.as_view()),
    url(r"^listregistercode/$", views.ListRegisterCodeView.as_view()),





    #良宝url
    url(r"^user/$", views.UserViewSet.as_view({'get': 'list', 'post': 'create'})),
    url(r"^user/(?P<pk>\d+)/$", views.UserViewSet.as_view({'get': 'retrieve', 'put': 'update', 'delete': 'destroy'})),
    url(r"^role/$", views.RoleViewSet.as_view({'get': 'list', 'post': 'create'})),
    url(r"^role/(?P<pk>\d+)/$", views.RoleViewSet.as_view({'get': 'retrieve', 'put': 'update', 'delete': 'destroy'})),
    url(r"^menu/$", views.MenuViewSet.as_view({'get': 'list', 'post': 'create'})),
    url(r"^menu/(?P<pk>\d+)/$", views.MenuViewSet.as_view({'get': 'retrieve', 'put': 'update', 'delete': 'destroy'})),
    url(r"^permission/$", views.PermissionViewSet.as_view({'get': 'list', 'post': 'create'})),
    url(r"^permission/(?P<pk>\d+)/$",
        views.PermissionViewSet.as_view({'get': 'retrieve', 'put': 'update', 'delete': 'destroy'})),
    url(r"^userrole/$", views.UserRoleViewSet.as_view({'get': 'list', 'post': 'create'})),
    url(r"^userrole/(?P<pk>\d+)/$",
        views.UserRoleViewSet.as_view({'get': 'retrieve', 'put': 'update', 'delete': 'destroy'})),

    url(r"^userroleslist/$", views.UserRolesList.as_view()),
    url(r"^createuserroles/$", views.CreateUserRoles.as_view()),
    url(r"^rolepermissionslist/$", views.RolePermissionsList.as_view()),
    url(r"^createrolepermissions/$", views.CreateRolePermissions.as_view()),
    url(r"^rolemenuslist/$", views.RoleMenusList.as_view()),
    url(r"^createrolemenus/$", views.CreateRoleMenus.as_view()),

    url(r"^rolepermission/$", views.RolePermissionViewSet.as_view({'get': 'list', 'post': 'create'})),
    url(r"^rolepermission/(?P<pk>\d+)/$",
        views.RolePermissionViewSet.as_view({'get': 'retrieve', 'put': 'update', 'delete': 'destroy'})),
    url(r"^rolemenu/$", views.RoleMenuViewSet.as_view({'get': 'list', 'post': 'create'})),
    url(r"^rolemenu/(?P<pk>\d+)/$",
        views.RoleMenuViewSet.as_view({'get': 'retrieve', 'put': 'update', 'delete': 'destroy'})),
    url(r"^test/$", views.Test.as_view()),
]